/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package org.cip.esymons.tramite.bc;

import java.util.Date;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingException;

import org.cip.esymons.tramite.be.Transaccion;

/**
 *
 * @author ChristianATE
 */
public class TransaccionDelegate {

    private TransaccionFacadeLocal local;

    public TransaccionDelegate() {
        this.local = lookupTransaccionFacade();
    }

    public void create(Transaccion transaccion)
    {
        local.create(transaccion);
    }

    public void edit(Transaccion transaccion)
    {
        local.edit(transaccion);
    }

    public void remove(Transaccion transaccion)
    {
        local.remove(transaccion);
    }

    public Transaccion find(Long id)
    {
        return local.find(id);
    }

    public List<Transaccion> findAll()
    {
        return local.findAll();
    }

    public List<Transaccion> listarTranExterXEmpleado(Long empl){
        return local.listarTranExterXEmpleado(empl);
    }

    public List<Transaccion> listarXEmpleado(Long empl){
        return local.listarTransaccionXEmpleado(empl);
    }
    
    public List<Transaccion> listarXSolicitante(Long sol){
        return local.listarTransaccionXSolicitante(sol);
    }

    public List<Transaccion> listarTransaccionXCobro() {
        return local.listarTransaccionXCobro();
    }

    public List<Transaccion> listarCertificados(){
        return local.listarCertificados();
    }

    public List<Transaccion> listarDocExtExpor(Date ini, Date fin, boolean estado, Integer est){
        return local.listarDocExtExpor(ini, fin, estado, est);
    }

    public List<Transaccion> listarDocExtSeg(Date ini, Date fin, Long est){
        return local.listarDocExtSeg(ini, fin, est);
    }

    private TransaccionFacadeLocal lookupTransaccionFacade() {
        try {
            Context c = new InitialContext();
            return (TransaccionFacadeLocal) c.lookup("java:comp/env/TransaccionFacade");
        } catch (NamingException ne) {
            Logger.getLogger(getClass().getName()).log(Level.SEVERE, "exception caught", ne);
            throw new RuntimeException(ne);
        }
    }
}
